/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FileSystem;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.regex.Pattern;

/**
 *
 * @author asfeor
 */
interface Find
{
	Collection find (String src, String mask); 
}
public class Findign implements Find {
    ArrayList <File> List = new ArrayList<File>();
    @Override
  public Collection find(String src, String mask) {
   File f=new File(src);
   
   try{ 
    String[] sDirList=f.list();
    int i;
    for (i=0; i<sDirList.length; i++){
     if (acsept(mask,sDirList[i])) List.add(new File(src+File.separator+sDirList[i]));
    }
            
   }catch(NullPointerException ex) {System.out.println("File "+f.getAbsolutePath()+" not executeble");
   }
   
 return List;
 }
 boolean  acsept(String expr, String name){
  boolean acses=Pattern.compile(expr).matcher(name).matches();    
return acses;        
} 
}
